<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>加解密时仅需要秘钥</title>
</head>
<body>

</body>
<script src="static/plugins/cryptoJs/rollups/aes.js"></script>
<script src="static/plugins/cryptoJs/components/mode-ecb.js"></script>
<script type="text/javascript">
    function Encrypt(word){
        var key = CryptoJS.enc.Utf8.parse("abcdefgabcdefg12");
        var srcs = CryptoJS.enc.Utf8.parse(word);
        var encrypted = CryptoJS.AES.encrypt(srcs, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
        return encrypted.toString();
    }
    function Decrypt(word){
        var key = CryptoJS.enc.Utf8.parse("abcdefgabcdefg12");
        var decrypt = CryptoJS.AES.decrypt(word, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
        return CryptoJS.enc.Utf8.stringify(decrypt).toString();
    }

    alert(Encrypt("孤傲苍狼，你好（Hello）"));
    alert(Decrypt(Encrypt("孤傲苍狼，你好（Hello）")))

</script>
</html>